<template>
	<view class="u-margin-left-20 u-margin-right-20" style="padding-bottom: 65px;">
		<u-navbar title="房源详情" @rightClick="rightClick" :autoBack="true" placeholder="true" @leftClick="nihao">
		</u-navbar>
		<view>
			<u-swiper :list="swiperlist" @change="change" @click="clickImg" keyName="image" indicator='true'
				height='300px'></u-swiper>
		</view>
		<view class="item">
			<view class="item-title">{{room.villageName}}
				{{room.type == '整租' ? room.houseNum + room.houseHall + room.toiletNum : room.roomType+'-朝'+room.direction}}
			</view>
			<view class="item-price" style="display: flex;">￥{{room.price}}/
				<view style="font-size: 10px;">
					{{room.payType}}
				</view>
			</view>
		</view>
		<!-- <u-cell-group>
			<u-cell title="服务费另计,详情咨询管家" @click="clickItem">
				<template #right-icon>
					<view style="color: #929292;font-size:13px;">联系管家 ></view>
				</template>
			</u-cell>
		</u-cell-group> -->
		<u-gap height="1" bg-color="#f8f8f8"></u-gap>
		<view class="item" style="display: flex; flex-wrap: wrap;">
			<view style="padding: 2px 4px;" v-for="(item,index) in tagList">
				<u-tag :text="item.title" type="warning" plain></u-tag>
			</view>
		</view>
		<view v-if="village.wayState == 1">
			<u-gap height="1" bg-color="#f8f8f8"></u-gap>
			<view class="wayClass">
				小区离地铁{{village.wayCode}}较近
			</view>
		</view>
		<view v-if="room.introduce">
			<u-gap height="1" bg-color="#f8f8f8"></u-gap>
			<u-card title="房源介绍" :border="false" :head-border-bottom="false" padding="0" title-size="20">
				<view class="u-padding-top-45 item" slot="body">
					{{room.introduce}}
				</view>
			</u-card>
		</view>
		<u-gap height="1" bg-color="#f8f8f8"></u-gap>
		<view style="position: relative;">
			<u-card title="小区介绍" :border="false" :head-border-bottom="false" padding="0" title-size="20">
				<template #body>
					<view class="u-padding-top-45" slot="body">
						<view class="u-flex" style="justify-content: space-between;margin-bottom: 20px;">
							<view class="item">
								<view style="color: $u-tips-color">建筑年份：{{village.year}}</view>
								<view class="color: $u-tips-color">建筑类型：{{village.type}}</view>
								<view class="color: $u-tips-color">绿化率：{{village.green}}%</view>
							</view>
							<image
								src="https://img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg"
								mode="widthFix" style="width: 250rpx;height: 200rpx;"></image>
						</view>
					</view>
				</template>
			</u-card>
		</view>
		<!-- <u-gap v-if="room.qrcode " height="1" bg-color="#f8f8f8"></u-gap> -->
		<view style="position: relative;">
			<u-card title="二维码介绍" :border="false" :head-border-bottom="false" padding="0" title-size="20">
				<template #body>
					<view class="u-padding-top-45" slot="body">
						<view class="u-flex" style="justify-content: space-between;margin-bottom: 20px;">
							<image show-menu-by-longpress :src="room.qrcode" mode="widthFix"
								style="width: 250rpx;height: 200rpx;"></image>
							<view class="item" style="width: 150px;">
								<view class="color: $u-tips-color;" style="text-align: right;">
									分享该房源二维码至<br />微信好友/朋友圈<br />享房东5-7日房租酬谢金</view>
								<view class="" style="width: 70px;margin-left: auto;margin-top: 10px;">
									<button open-type="share"
										style="background-color: #FFDA00;width: 70px;height: 20px;line-height: 20px;font-size: 12px;">分
										享</button>
								</view>
							</view>
						</view>
					</view>
				</template>
			</u-card>
		</view>
		<!-- 	<view style="position: relative;">
			<u-card title="周边交通" :border="false" :head-border-bottom="false" padding="0" title-size="20">
				<view class="u-padding-top-45" slot="body" style="margin-bottom: 20px;">
					<image
						src="http://api.map.baidu.com/staticimage/v2?ak=CB9b776692623d30a148b5c5dc2b75a6&mcode=666666&center=120.213023,30.300046&width=800&height=360&zoom=18&markers=120.213023,30.300046&markerStyles=-1,http://api.map.baidu.com/images/marker_red.png,-1,23,25"
						style="width: 750rpx;height: 300rpx;"></image>
				</view>
			</u-card>
		</view> -->
		<view style="position: relative;">
			<u-card title="服务介绍" :border="false" :head-border-bottom="false" padding="0" title-size="20">

				<view class="u-padding-top-45" slot="body" style="margin-bottom: 20px;" border='false'>
					<u-cell-group :border="false">
						<u-cell icon="heart" title="百万房东直租 核验权益才签约" :arrow="false" hover-class="none" :border='false'
							:border-bottom="false"></u-cell>
						<u-cell icon="level" title="全城0佣入住 租客联盟有保障" :arrow="false" hover-class="none" :border='false'
							:border-bottom="false"></u-cell>
						<u-cell icon="star" title="全程无人带看 数智邻里更省心" :arrow="false" hover-class="none" :border='false'
							:border-bottom="false"></u-cell>
						<u-cell icon="rmb" title="平台保险定制 诚信守约享赔付" :arrow="false" hover-class="none"
							:border='false'></u-cell>
					</u-cell-group>
				</view>
			</u-card>
		</view>
		<view style="position: relative;" v-if="room.xwAppraises!==null">
			<u-card title="房屋评论:" :border="false" :head-border-bottom="false" padding="0" title-size="20"
				:foot-border-top='false'>
				<template #body style="margin-top: 4rpx;">
					<view v-for="(item,index) in room.xwAppraises.slice(0,2)" :key="index" class="" slot="body">
						<view style="display: flex;align-items: center;padding-top: 5px;">
							<u-avatar
								:src="item.user.avatar? item.user.avatar : 'https://www.gzxwsz.com/profile/upload/2024/12/26/c15415a400194d87224fe7d5938ff59f.jpg'"
								size="25"></u-avatar>
							<view style="margin-left: 5rpx;">
								{{item.user.userName}}
							</view>
						</view>
						<view class="u-body-item" style="padding: 4px 0">
							<view class="comment">
								{{item.appraise}}
							</view>
							<template v-if="item.imageList">
								<view style="display: flex;margin-top: 5px;">
									<view v-for="(itemimage,indeximages) in item.imageList" :key="indeximages"
										@click="picturePreview(item.imageList,indeximages)"
										style="margin-right: 10rpx;">
										<image :src=itemimage.imgUrl style="height: 40px;" mode="heightFix"></image>
									</view>
								</view>
							</template>
						</view>
					</view>
				</template>
				<template #foot>
					<view class="u-border-bottom" style="width: 100%;">
						<view style="padding-bottom: 10px;width: 90px;margin-left: auto;" @click="commentSwitch = true">
							<u-icon name="arrow-right-double" size="20" color="" label="查看更多" labelPos='left'></u-icon>
						</view>
					</view>
				</template>
			</u-card>
		</view>
		<!-- 评论 -->
		<u-popup :show="commentSwitch" :closeable='true' :round="10" mode="bottom" @close="commentSwitch = false"
			:close-on-click-overlay="false" bgColor='#F8F8F8'>
			<view><!-- overflow-y: scroll -->
				<view style="text-align: center;padding: 12px;font-size: 17px;">
					评价
				</view>
				<view style="height: 78vh;overflow-y: scroll">
					<view v-for="(item,index) in room.xwAppraises" :key="index" style="padding: 0px 13px;" slot="body">
						<view style="display: flex;align-items: center;padding-top: 5px;">
							<u-avatar
								:src="item.user.avatar? item.user.avatar : 'https://www.gzxwsz.com/profile/upload/2024/12/26/c15415a400194d87224fe7d5938ff59f.jpg'"
								size="34"></u-avatar>
							<view style="margin-left: 7px;">
								{{item.user.userName}}
							</view>
						</view>
						<view class="u-body-item"
							style="padding: 10px 10px;background-color: #ffffff;border-radius: 10px;margin-top: 4px;">
							<view class="comment">
								{{item.appraise}}
							</view>
							<template v-if="item.imageList">
								<view style="display: flex;margin-top: 12px;">
									<view v-for="(itemimage,indeximages) in item.imageList" :key="indeximages"
										@click="picturePreview(item.imageList,indeximages)"
										style="margin-right: 10rpx;">
										<image :src=itemimage.imgUrl style="height: 40px;" mode="heightFix"></image>
									</view>
								</view>
							</template>
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<!-- 以上为评论 -->
		<view style="position: relative;">
			<u-card title="" :border="false" :head-border-bottom="false" padding="0" title-size="16"
				:foot-border-top="false">
				<view class="u-padding-top-45" slot="body" style="margin-bottom: 20px;">
					<view class="u-flex" style="display: flex;align-items: center;">
						<view class="u-m-r-10">
							<u-avatar :src="user.avatar" size="40"></u-avatar>
						</view>
						<view class="u-flex-1" style="line-height: 40px;height: 40px;}">
							<view v-if="user.realName!=null && user.realName!=''" class="u-font-16 u-p-b-20">
								{{user.realName}}
							</view>
							<view v-if="user.realName==null||user.realName==''" class="u-font-16 u-p-b-20">房屋实际管理人
							</view>
						</view>
						<view class="arrow-right">
							<u-button color="#FFDA00" size="mini" @click="clickItem">联系房东</u-button>
						</view>
					</view>
				</view>
				<view v-show="room.keyPassword !== undefined&&room.keyPassword !== null" slot="body"
					style="margin-bottom: 20px;">
					<view class="u-flex" style="display: flex;align-items: center;">
						<view class="u-m-r-10">
							<u-avatar src="" size="40"></u-avatar>
						</view>
						<view class="u-flex-1" style="line-height: 40px;height: 40px;}">
							<view v-if="room.keyName!=null && room.keyName!=''" class="u-font-16 u-p-b-20">
								{{room.keyName}}
							</view>
							<view v-if="room.keyName==null || room.keyName==''" class="u-font-16 u-p-b-20">钥匙管理人
							</view>
						</view>
						<view class="arrow-right">
							<u-button color="#FFDA00" size="mini" @click="clickItemTwo">联系钥匙管理人/存放门店</u-button>
						</view>
					</view>
				</view>
				<view slot="body">
					<button open-type="contact" bindcontact="handleContact"
						style="background-color: transparent;padding: 0;">
						<view class="u-flex" style="display: flex;align-items: center;">
							<view class="u-m-r-10">
								<u-avatar src="" size="40"></u-avatar>
							</view>
							<view class="u-flex-1"
								style="line-height: 40px;height: 40px;font-size: 14px;color: #666666;">
								<view class="u-font-16 u-p-b-20">平台客服</view>
							</view>
							<view class="arrow-right">
								<u-button color="#FFDA00" size="mini" @click="clickItemone">平台客服</u-button>
							</view>
						</view>
					</button>
				</view>
			</u-card>
			<view style="color: red;font-size: 12px;margin-bottom: 10px;padding: 5px 15px;">
				注：为避免房源信息被第三方泄露，在看完房后您可以与房东直接联系，并线上签约
			</view>
			<!-- 	<view style="padding-bottom: 15px;">
				<u-divider text="心房产为您服务"></u-divider>
			</view> -->
		</view>
		<view class="undersides" style="display: flex;flex-direction: row-reverse;">
			<view class="one" @click="showings(room.id)">
				<button
					style="color: #000000;background-color: #FFDA00;font-size: 15px;line-height: 35px;">预约看房</button>
			</view>
			<view class="two" @click="contract(room.id,room.price,room.payType)">
				<button
					style="color: #ffffff;background-color: #FF5500;font-size: 15px;line-height: 35px;">远程签约</button>
			</view>
			<view class="three" @click="concern">
				<!-- <view style="height: 25px;" v-if="panduan==1">
					<image src="@/static/index/rentinghouse/gaunzhu1.png" mode="widthFix" style="width: 25px">
					</image>
				</view>
				<view style="height: 25px;" v-else>
					<image src="@/static/index/rentinghouse/gaunzhu2.png" mode="widthFix" style="width: 25px">
					</image>
				</view> -->
				<view style="font-size: 12px;align-items: center;">
					关注
				</view>
			</view>
		</view>
		<!-- 新增 -->
		<u-modal :show="show" :title="title" showCancelButton="true" @cancel="cancelss" @confirm="start">
			<view class="slot-content">
				<!-- <input type="text" /> -->
				<view style="display: flex;justify-content: space-between;align-items: center;margin: 10px 0;">
					<view style="margin-right: 5px;font-size: 14px;width: 30px;">
						最终价格
					</view>
					<view class="">
						<u-input placeholder="请输入您的最终成交价" border="surround" v-model="selecteds.price"
							inputAlign='right'></u-input>
					</view>
					<view style="width: 26px;">
						/元
					</view>
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;margin: 10px 0;">
					<view style="margin-right: 5px;font-size: 14px;width: 60px;">
						支付周期
					</view>
					<view @click="paymentss">
						<u-input placeholder="支付方式(推荐月付)" border="surround" v-model="selecteds.specific" disabled='true'
							disabledColor='#ffffff' inputAlign='right'></u-input>
					</view>
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;margin: 10px 0;">
					<view style="margin-right: 5px;font-size: 14px;width: 30px;">
						入住时间
					</view>
					<view class="">
						<u-input placeholder="交房租时间(推荐15号)" border="surround" v-model="selecteds.approximately"
							inputAlign='right'></u-input>
					</view>
					<view style="width: 26px;">
						/号
					</view>
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;margin: 10px 0;">
					<view style="margin-right: 5px;font-size: 14px;width: 30px;">
						租期
					</view>
					<view class="">
						<u-input placeholder="租期" border="surround" v-model="selecteds.rentDate"
							inputAlign='right'></u-input>
					</view>
					<view style="width: 26px;">
						月
					</view>
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;margin: 10px 0;">
					<view style="margin-right: 5px;font-size: 14px;width: 30px;">
						押金
					</view>
					<view class="">
						<u-input placeholder="押金" border="surround" v-model="selecteds.deposit"
							inputAlign='right'></u-input>
					</view>
					<view style="width: 26px;">
						/元
					</view>
				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	import {
		urlHead
	} from '@/serve/serve.js'
	import {
		get,
		post
	} from '@/serve/method.js'
	import {
		test,
	} from '@/node_modules/uview-plus';
	export default {
		data() {
			return {
				// 评论开关
				commentSwitch: false,
				// 二维码
				tanchuang: false,
				imgess: '',
				// 以上为二维码
				keyword: '',
				room: {},
				swiperlist: [],
				tagList: [],
				village: {},
				user: {},
				houseId: '',
				userId: '',
				panduan: '',
				dISCRIMINATION: '', //人脸识别开关
				// 以下是签合同
				title: '最终成交价',
				show: false,
				selecteds: {
					house: '',
					price: '',
					approximately: '15',
					specific: '',
					rentDate: '',
					deposit: '',
				},
				oness: {
					one: '',
					two: '',
					three: '',
				},
				// 以上是去签约
			}
		},
		// 分享朋友圈
		onShareTimeline: function(res) {
			return {
				title: '有房出租，邻里帮您租！' +
					'房东直租，租客0佣，' +
					'小额酬谢分享，大爱爽爽贵阳！',
				query: `houseId=${this.houseId}&userId=${this.userId}`,
			}
		},
		// 分享朋友
		onShareAppMessage: function(res) {
			return {
				title: '有房出租，邻里帮您租！' +
					'房东直租，租客0佣，' +
					'小额酬谢分享，大爱爽爽贵阳！',
				path: `/pages/detail/detail?houseId=${this.houseId}&userId=${this.userId}`,
			}
		},
		onShow() {
			if (this.dISCRIMINATION == 'true') {
				let recognition = wx.getEnterOptionsSync()
				// options数据在上方
				console.log('---options1', recognition)
				console.log('---options2', recognition.referrerInfo.extraData.faceResult.ErrorMsg)
				console.log('---options3', recognition.referrerInfo.extraData.faceResult.ErrorMsg.substring(0, 2))
				if (recognition.referrerInfo.extraData.faceResult.ErrorMsg.substring(0, 2) == "成功") {
					this.dISCRIMINATION = 'false'
					uni.navigateTo({
						url: `/pages/houseViewing/appointment?id=${this.houseId}`
					});
				}
			}
		},
		onLoad: function(option) {
			console.log(option, '分享333')
			// 以下为之前的,以上为新加的登录
			let that = this
			that.houseId = option.houseId //上个页面传递的参数。
			// 登录
			wx.login({
				success(res) {
					if (res.code) {
						let urls = "/api/minLogin"
						get(urls, {
							code: res.code
						}).then((res) => {
							let three = {
								"vuex_token": res.data.jwtToken,
								"vuex_user": res.data
							}
							uni.setStorage({
								key: 'lifeData',
								data: three,
								success: function(resthree) {
									console.log(resthree, '储存');
								}
							});
							that.userId = res.data.userId
							if (option.scene !== undefined) {
								let urlstwo = `/api/system/house/editOne/${option.scene}`
								get(urlstwo).then((restwo) => {
									that.houseId = restwo.data.houseId //上个页面传递的参数。
									console.log(restwo, 9999)
									uni.getStorage({
										key: 'lifeData',
										success: function(res) {
											let urlone =
												'/api/system/house/clickHouseDetail'
											post(urlone, {
												userId: restwo.data.userId,
												newUserId: that.userId,
												houseId: that.houseId
											}).then((resone) => {
												that.findHouseById(that
													.houseId, that
													.userId);
												that.query()
											})
										}
									});
								})
							} else {
								// 渲染当前房源信息
								uni.getStorage({
									key: 'lifeData',
									success: function(res) {
										let urlone = '/api/system/house/clickHouseDetail'
										post(urlone, {
											userId: option.userId,
											newUserId: that.userId,
											houseId: option.houseId
										}).then((resone) => {
											that.findHouseById(that.houseId, that
												.userId);
											that.query()
										})
									}
								});
							}
						})
					} else {
						console.log('登录失败！' + res.errMsg)
					}
				},
				fail(res) {
					console.log(res, '登陆失败8888888')
					that.findHouseById(that.houseId, option.userId);
				}
			})
		},
		methods: {
			// 图片预览
			picturePreview(item, index) {
				console.log(item, 9999)
				let imgArr = item.map(val => {
					return val.imgUrl
				})
				console.log(imgArr);
				// 预览图片
				uni.previewImage({
					current: index,
					urls: imgArr
				});
			},
			// 二维码
			erweima() {
				let url = '/api/system/house/updateHouseQrCode '
				post(url, {
					'userId': this.userId,
					'houseId': this.houseId
				}).then((res) => {
					console.log(res)
					this.imgess = res.data.qrcode
					this.tanchuang = true
				})
			},
			// 以上为二维码
			// 登录
			denglu() {
				wx.login({
					success(res) {
						if (res.code) {
							let urls = "/api/minLogin"
							get(urls, {
								code: res.code
							}).then((res) => {
								let three = {
									"vuex_token": res.data.jwtToken,
									"vuex_user": res.data
								}
								uni.setStorage({
									key: 'lifeData',
									data: three,
									success: function(resthree) {
										console.log(resthree, '储存');
									}
								});

							})
						} else {
							console.log('登录失败！' + res.errMsg)
						}
					}
				})
			},
			// 返回
			nihao() {
				console.log(1111)
				this.denglu()
				uni.switchTab({
					url: '/pages/homepage/index'
				});
			},
			// 支付周期
			paymentss() {
				let that = this
				uni.showActionSheet({
					itemList: ['周付', '月付', '季付', '年付'],
					success: function(res) {
						console.log(res)
						console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
						if (res.tapIndex == 0) {
							that.selecteds.specific = '周付'
						}
						if (res.tapIndex == 1) {
							that.selecteds.specific = '月付'
						}
						if (res.tapIndex == 2) {
							that.selecteds.specific = '季付'
						}
						if (res.tapIndex == 3) {
							that.selecteds.specific = '年付'
						}
					},
					fail: function(res) {
						console.log(res.errMsg);
					}
				});
			},
			// 查询关注
			query() {
				let url = "/api/system/house/list"
				let that = this
				post(url, {
					houseId: this.houseId,
					userId: this.userId,
				}).then(data => {
					let one = data.rows.length
					if (one == 0) {
						this.panduan = 0
						console.log('未关注')
					} else {
						console.log('1111111')
						if (data.rows[0].status == 0) {
							this.panduan = 0
							console.log(this.panduan, '未关注')
						} else {
							this.panduan = 1
							console.log(this.panduan, '关注')
						}
					}
				});
			},
			// 增加/取消
			concern() {
				if (this.panduan == 0) {
					let url = "/api/system/house/add"
					post(url, {
						houseId: this.houseId,
						userId: this.userId,
						status: 1,
					}).then(data => {
						// console.log(data, '关注')
						if (data.msg == "操作成功") {
							this.panduan = 1
						}
					});
				} else {
					let url = "/api/system/house/edit"
					post(url, {
						houseId: this.houseId,
						userId: this.userId,
						status: 0,
					}).then(data => {
						console.log(data, '关注')
						if (data.msg == "操作成功") {
							this.panduan = 0
						}
					});
				}
			},
			showings(id) {
				let that = this
				this.denglu()
				uni.getStorage({
					key: 'lifeData',
					success: function(resone) {
						let url = "/api/user/selectUserById"
						get(url, {
							userId: resone.data.vuex_user.userId
						}).then((res) => {
							console.log(res.data.authStatus, "验证")
							if (res.data.authStatus !== "2" && res.data.authStatus !== "1") {
								uni.showModal({
									title: '提示',
									content: '本平台为诚信共享，便民互助平台，为保障您的权益及更好的为您服务，请进行认证。',
									success: function(res) {
										uni.navigateTo({
											url: '/pages/mine/authentication'
										});
									}
								});
							} else {
								that.dISCRIMINATION = 'true'
								console.log(resone.data.vuex_user.userId, 9999999)
								let urls = `/api/user/face?userId=${resone.data.vuex_user.userId}`
								get(urls).then((res) => {
									console.log(res)
									wx.navigateToMiniProgram({
										appId: 'wx1cf2708c2de46337', // 公证签小程序APPID
										path: `/pages/face/index?bizToken=${res.data}`, // 刷脸页面地址
									})
								})
							}
						})
					},
					fail: function(res) {
						if (res.errMsg == 'getStorage:fail data not found') {
							uni.reLaunch({
								url: '/pages/index/index'
							});
						}
					}
				})
			},
			// 以下是合同
			cancelss() {
				let that = this
				if (that.selecteds.specific == '') {
					console.log(222222222222, that.oness.two)
					that.selecteds.specific = that.oness.two
				}
				if (that.selecteds.approximately == '') {
					that.selecteds.approximately = that.oness.three
				}
				that.show = false
			},
			contract(house, price, payType) {
				let that = this
				this.denglu()
				get(`/api/user/getNoSignContract/${that.userId}`).then((resyy) => {
					if (resyy.data.sysUser.authStatus !== '2' && resyy.data.sysUser.authStatus !== '1') {
						uni.showModal({
							title: '提示',
							content: '本平台为诚信共享，便民互助平台，为保障您的权益，以便更好的为您服务，请进行认证！！！',
							success: function(res) {
								if (res.confirm) {
									uni.navigateTo({
										url: '/pages/mine/authentication'
									});
								}
							}
						});
					} else {
						let that = this
						console.log(price, 888888)
						uni.showModal({
							title: '提示',
							content: '为避免您工作变动和其他未知情况出现导致您无法履约，请选择您与房东拟定好的最短租期，以保障您的押金权益，届时若需续租，平台将为您提供优先提供优先续约及租住权益；租期内若有提前退租的情况，平台将为您提供转租服务，以保障您的权益！！！',
							success: function(res) {
								that.selecteds.house = house
								that.selecteds.price = price
								that.selecteds.specific = payType
								that.selecteds.approximately = 15
								that.oness.one = price
								that.oness.two = payType
								that.oness.three = 15
								that.show = true
								console.log(that.selecteds, 9999)
							}
						});

					}
				}).catch((res) => {
					console.log('失败')
				})
			},
			start() {
				let that = this
				if (test.isEmpty(that.selecteds.rentDate)) {
					return wx.showToast({
						title: '请输入租期（月）',
						icon: 'none',
						duration: 2000
					})
				}
				that.show = false
				let urls = "/api/user/signContract"
				console.log(that.selecteds.rentDate, 9999999)
				post(urls, {
					"userId": that.userId,
					'houseId': that.selecteds.house,
					'payRentOne': that.selecteds.price, //最终价格
					'specific': that.selecteds.specific, //月付，年付
					'approximately': that.selecteds.approximately, //多少号交租
					'rentDate': that.selecteds.rentDate, //租期
					'deposit': that.selecteds.deposit, //押金
				}).then((itemss) => {
					console.log(itemss.data, 88888)
					let fileList = JSON.stringify(itemss.data)
					uni.navigateTo({
						url: '/pages/houseViewing/interlinking?id=' +
							encodeURIComponent(fileList),
					});
				})
			},
			// 以上是合同
			clickItem() {
				//拨打固定电话
				console.log(this.room.ownerPhone, 9999)
				uni.makePhoneCall({
					phoneNumber: this.room.ownerPhone,
				});
			},
			clickItemone() {
				//拨打固定电话
				uni.makePhoneCall({
					phoneNumber: '0851 85963040'
				});
			},
			clickItemTwo() {
				//拨打固定电话
				uni.makePhoneCall({
					phoneNumber: this.room.keyPassword,
				});
			},
			findHouseById(houseId, userId) {
				let url = "/api/house/findHouseById";
				get(url, {
					id: houseId,
					userId: userId
				}).then(data => {
					let room = data.data
					console.log(room)
					if (room.type == 0) {
						room.type = '整租'
					} else if (room.type == 1) {
						room.type = '合租'
					}
					if (room.roomType == 1) {
						room.roomType = '主卧'
					} else if (room.roomType == 2) {
						room.roomType = '次卧'
					} else {
						room.roomType = '未知'
					}

					if (test.isEmpty(room.houseNum)) {
						room.houseNum = ''
					}
					if (test.isEmpty(room.houseHall)) {
						room.houseHall = ''
					}
					if (test.isEmpty(room.toiletNum)) {
						room.toiletNum = ''
					}
					if (test.isEmpty(room.floor)) {
						room.floor = ''
					} else {
						room.floor = room.floor + '层'
					}
					if (room.imageList !== undefined) {
						this.swiperlist = room.imageList.map(val => {
							return {
								title: val.imageName,
								image: val.imgUrl
							}
						})
					}
					// console.log(room.featureList, 888888888)
					if (room.featureList !== undefined) {
						this.tagList = room.featureList.map(val => {
							return {
								title: val.feature,
							}
						})
					}
					// room.user.avatar = urlHead + room.user.avatar
					this.user = room.user
					console.log(room.village, 999999)
					if (room.village !== undefined) {
						this.village = room.village
					}
					this.room = room
					// console.log(this.room, 89898)
				});
			},
			clickImg(index) {
				let imgArr = this.swiperlist.map(val => {
					return val.image
				})
				console.log(imgArr);
				// 预览图片
				uni.previewImage({
					current: index,
					urls: imgArr
				});
			}
		}
	}
</script>

<style>
	/* page不能写带scope的style标签中，否则无效 */
	page {
		background-color: rgb(255, 255, 255);
	}
</style>


<style lang="scss" scoped>
	button::after {
		display: none;
		font-size: 14px;
	}

	.comment {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		/* 控制显示的最大行数 */
		-webkit-box-orient: vertical;
		font-size: 13px;
		/* 设置字体大小 */
		line-height: 1.5;
		/* 设置行高 */
	}

	.outsize {
		padding: 20px 0;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;
		background-image: radial-gradient(circle at center, #ffffff, #FFF7D0);

		.imging {
			width: 50vw;
		}
	}

	.undersides {
		width: 100vw;
		border-radius: 8px;
		border: 1px #f3f3f3 solid;
		height: 65px;
		position: fixed;
		left: 0;
		bottom: 0;
		background-color: #ffffff;
		border-radius: 10px;
		padding-top: 8px;

		button {
			width: 90px;
		}

		.one {
			margin: 0 20px;
		}

		.two {
			// margin: 0 20px;
			margin-left: 20px;
		}

		.three {
			margin-right: auto;
			margin-left: 55px;
		}
	}

	.item {
		padding: 25rpx;
		line-height: 50rpx;
	}

	.item-title {
		font-size: 42rpx;
		// color: $u-main-color;
		font-weight: bold;
	}

	.item-price {
		font-weight: normal;
		font-size: 45rpx;
		color: #F59A0C;
		margin-top: 15px;
	}

	.item-desc {
		font-weight: normal;
		font-size: 36rpx;
		// color: $u-tips-color;
	}

	.arrow-right {
		margin-left: auto;
		font-weight: normal;
		font-size: 28rpx;
	}

	.wayClass {
		color: #606266;
		padding: 30rpx;
		line-height: 50rpx;
	}
</style>